package com.toocms.jinjuhang.config

import com.toocms.jinjuhang.dialog.options.OptionsItem

enum class Gender(val code: String, val title: String) : OptionsItem {
    MALE("1", "男"), FEMALE("2", "女");

    override fun title() = title

    companion object {
        fun code2gender(code: String) = when (code) {
            MALE.code -> MALE
            FEMALE.code -> FEMALE
            else -> null
        }

        fun code2title(code: String) = when (code) {
            MALE.code -> MALE.title
            FEMALE.code -> FEMALE.title
            else -> ""
        }
    }
}